package com.ellricky.excute_president

import android.app.Activity
import android.content.Intent
import androidx.fragment.app.Fragment
import com.ellricky.baselib.BaseConstant
import com.ellricky.baselib.util.EAppUtil
import com.ellricky.excute_president.ui.activity.home.leave.LeaveApplyDetailActivity
import com.ellricky.excute_president.ui.activity.home.task.TaskCreateActivity
import com.ellricky.excute_president.ui.activity.home.task.TaskDetailActivity
import com.ellricky.excute_president.ui.activity.meet.AmMeetingAddActivity


/////////////////////////////////////////////////////////////////////////////
////  // 页面跳转
/////////////////////////////////////////////////////////////////////////////


internal fun jumpLeaveApplyDetail(ctx: Activity, id: String?, approveStatus: String?) {
    val intent = Intent(ctx, LeaveApplyDetailActivity::class.java)
    intent.putExtra(BaseConstant.KEY_ID, id)
    intent.putExtra(KEY_APPROVE_STATUS, approveStatus)
    ctx.startActivityForResult(intent, 0)
}

internal fun jumpTaskDetail(fragment: Fragment, id: String?, pageType: Int) {
    val activity = fragment.activity
    activity?.let {
        val intent = Intent(it, TaskDetailActivity::class.java)
        intent.putExtra(BaseConstant.KEY_ID, id)
        intent.putExtra(KEY_PAGE_TYPE, pageType)
        fragment.startActivityForResult(intent, 0)
    }

}

internal fun jumpTaskAdd(fragment: Fragment, pageType: Int, taskTitle: String) {
    val activity = fragment.activity
    activity?.let {
        val intent = Intent(it, TaskCreateActivity::class.java)
        intent.putExtra(KEY_PAGE_TYPE, pageType)
        intent.putExtra(KEY_TASK_TITLE, taskTitle)
        fragment.startActivityForResult(intent, 0)
    }
}

///////////////////////////////////////////////////////////////////////////
// 班级管理
///////////////////////////////////////////////////////////////////////////


internal fun jumpAmMeetAdd(frg: Fragment) {
    val intent = Intent(frg.activity, AmMeetingAddActivity::class.java)
    EAppUtil.jumpForResult(frg, intent)
}




